<?php
include_once './templates/header.php';

$category = "";
$result4 = mysql_query("SELECT *,p.product_id as ppid FROM `products` p, `categories` c
                            WHERE p.active = 1 AND c.active=1 AND p.category_id = c.category_id
                            ORDER BY p.product_id DESC
                            LIMIT 9");


while ($row4 = mysql_fetch_array($result4)) {

    $product_grid_item .= '<div class="col-sm-4">
                        <div class="product-image-wrapper">
                            <div class="single-products">
                                <div class="productinfo text-center">
                                    <img src="admin/assets/product_images/' . $row4['product_image_url'] . '" alt="" />
                                    <h2>' . $row4['category'] . '<br/>' . $row4['product'] . '</h2>
                                    <h4>' . $row4['product_code'] . '</h4>
                                    <p>' . $row4['summary'] . '</p>
                                </div>
                                <a href="product_details.php?pid=' . $row4['ppid'] . '">
                                <div class="product-overlay">
                                    <div class="overlay-content">
                                        <h2>' . $row4['category'] . '<br/>' . $row4['product'] . '</h2>
                                        <h4>' . $row4['product_code'] . '</h4>
                                        <p>' . $row4['summary'] . '</p>
                                    </div>
                                </div>
                                </a>
                            </div>
                            <div class="choose">
                                <ul class="nav nav-pills nav-justified">


                                </ul>
                            </div>
                        </div>
                    </div>';
}
?>

<section id="slider"><!--slider-->
    <div class="container">
        <div class="row">
            <div class="col-sm-12">
			<h2 class="title text-center">Home</h2>
                <div id="slider-carousel" class="carousel slide" data-ride="carousel">
                    <ol class="carousel-indicators">
                        <li data-target="#slider-carousel" data-slide-to="0" class="active"></li>
                        <li data-target="#slider-carousel" data-slide-to="1"></li>
                        <li data-target="#slider-carousel" data-slide-to="2"></li>
                    </ol>

                    <div class="carousel-inner">
                        <div class="item active">
                            <div class="col-sm-6">
                                <h1><span>Miyako</span>-Blender</h1>
                                <h2>Find your Blenders. All the latest models. </h2>
                                <p>Buy Blenders, Mixers & Processors from our Small Kitchen Appliances range at Miyako direct</p>
                                <!--<button type="button" class="btn btn-default get">Get it now</button>-->
                            </div>
                            <div class="col-sm-6">
                                <img src="images/home/slider/1.jpg" class="girl img-responsive" alt="" />
                                <!--<img src="images/home/pricing.png"  class="pricing" alt="" />-->
                            </div>
                        </div>
                        <div class="item">
                            <div class="col-sm-6">
                                <h1><span>Miyako</span>-Rice Cooker</h1>
                                <h2>Get dinner on the table in record time with these rice cookers. </h2>
                                <p>#1 Rice Cooker Brand in the US<br/>
                                    Cooking pot is made completely of surgical-grade 304 stainless steel<br/>
                                    Simple, one-touch operation with automatic keep-warm<br/>
                                    Includes measuring cup and serving spatula</p>
                                <!--<button type="button" class="btn btn-default get">Get it now</button>-->
                            </div>
                            <div class="col-sm-6">
                                <img src="images/home/slider/2.jpg" class="girl img-responsive" alt="" />
                                <!--<img src="images/home/pricing.png"  class="pricing" alt="" />-->
                            </div>
                        </div>

                        <div class="item">
                            <div class="col-sm-6">
                                <h1><span>Miyako</span>-Water Dispenser</h1>
                                <h2>Selection of Hot & Cold Water Dispensers</h2>
                                <p>Shop our selection of Water Coolers in the Kitchen Department at The Home Depot.</p>
                                <!--<button type="button" class="btn btn-default get">Get it now</button>-->
                            </div>
                            <div class="col-sm-6">
                                <img src="images/home/slider/3.jpg" class="girl img-responsive" alt="" />
                                <!--<img src="images/home/pricing.png" class="pricing" alt="" />-->
                            </div>
                        </div>

                    </div>

                    <a href="#slider-carousel" class="left control-carousel hidden-xs" data-slide="prev">
                        <i class="fa fa-angle-left"></i>
                    </a>
                    <a href="#slider-carousel" class="right control-carousel hidden-xs" data-slide="next">
                        <i class="fa fa-angle-right"></i>
                    </a>
                </div>

            </div>
        </div>
    </div>
</section><!--/slider-->

<section>
    <div class="container">
        <div class="row">
            <div class="col-sm-3">
                <?php include_once './templates/left_sidebar.php'; ?>
            </div>

            <div class="col-sm-9 padding-right">
                <div class="features_items"><!--features_items-->
                    <h2 class="title text-center">Featured Items</h2>                  
                    <?php print $product_grid_item; ?>
                </div><!--features_items-->

                <div class="category-tab"><!--category-tab-->
                    <div class="col-sm-12">
                        <ul class="nav nav-tabs">
                            <?php
                            
                            $query7n8 = "SELECT * FROM `categories` 
                                         WHERE active = 1 
                                         ORDER BY category_id DESC LIMIT 6"; //LIMIT 6
                            
                            $result7 = mysql_query($query7n8);
                            $tag_count = 1;
                            while ($row7 = mysql_fetch_array($result7)) {
                                $category = $row7['category'];
                                $category_tag = $row7['category_id'];

                                $li_class = '';
                                if ($tag_count == 1) {
                                    $li_class = 'class="active"';
                                }

                                print '<li ' . $li_class . '><a href="#prod' . $category_tag . '" data-toggle="tab">' . $category . '</a></li>';
                                $tag_count++;
                            }
                            ?>

                        </ul>
                    </div>
                    <div class="tab-content">

                        <?php
                        $result8 = mysql_query($query7n8);
                        $active = 'active';
                        while ($row8 = mysql_fetch_array($result8)) {
                            $category_id = $row8['category_id'];

                            print '<div class="tab-pane fade '. $active .' in" id="prod' . $category_id . '" >';
                            $active = '';
                            
                            $result9 = mysql_query("SELECT * FROM `products` 
                                                    WHERE active = 1 AND category_id = $category_id
                                                    ORDER BY product_id DESC LIMIT 4");

                            while ($row9 = mysql_fetch_array($result9)) {
                                $product_image_url = $row9['product_image_url'];
                                $product_code = $row9['product_code'];
                                print ' <div class="col-sm-3">
                                <div class="product-image-wrapper">
                                    <div class="single-products">
                                        <div class="productinfo text-center">
                                            <img src="admin/assets/product_images/' . $product_image_url . '" alt="" />
                                            <h2>' . $product_code . '</h2>
                                        </div>

                                    </div>
                                </div>
                            </div>';
                            }
                            print '</div>';
                        }
                        ?>

                                        </div>

                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div><!--/category-tab-->
<?php if (!empty($_COOKIE['search'])) { ?>
                    <div class="recommended_items"><!--recommended_items-->
                        <h2 class="title text-center">recommended items</h2>

                        <div id="recommended-item-carousel" class="carousel slide" data-ride="carousel">
                            <div class="carousel-inner">
                                <div class="item active">	
                                    <div class="col-sm-4">
                                        <div class="product-image-wrapper">
                                            <div class="single-products">
                                                <div class="productinfo text-center">
                                                    <img src="images/home/recommend1.jpg" alt="" />
                                                    <h2>$56</h2>
                                                    <p>Easy Polo Black Edition</p>

                                                </div>

                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-sm-4">
                                        <div class="product-image-wrapper">
                                            <div class="single-products">
                                                <div class="productinfo text-center">
                                                    <img src="images/home/recommend2.jpg" alt="" />
                                                    <h2>$56</h2>
                                                    <p>Easy Polo Black Edition</p>

                                                </div>

                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-sm-4">
                                        <div class="product-image-wrapper">
                                            <div class="single-products">
                                                <div class="productinfo text-center">
                                                    <img src="images/home/recommend3.jpg" alt="" />
                                                    <h2>$56</h2>
                                                    <p>Easy Polo Black Edition</p>

                                                </div>

                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="item">	
                                    <div class="col-sm-4">
                                        <div class="product-image-wrapper">
                                            <div class="single-products">
                                                <div class="productinfo text-center">
                                                    <img src="images/home/recommend1.jpg" alt="" />
                                                    <h2>$56</h2>
                                                    <p>Easy Polo Black Edition</p>

                                                </div>

                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-sm-4">
                                        <div class="product-image-wrapper">
                                            <div class="single-products">
                                                <div class="productinfo text-center">
                                                    <img src="images/home/recommend2.jpg" alt="" />
                                                    <h2>$56</h2>
                                                    <p>Easy Polo Black Edition</p>

                                                </div>

                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-sm-4">
                                        <div class="product-image-wrapper">
                                            <div class="single-products">
                                                <div class="productinfo text-center">
                                                    <img src="images/home/recommend3.jpg" alt="" />
                                                    <h2>$56</h2>
                                                    <p>Easy Polo Black Edition</p>

                                                </div>

                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <a class="left recommended-item-control" href="#recommended-item-carousel" data-slide="prev">
                                <i class="fa fa-angle-left"></i>
                            </a>
                            <a class="right recommended-item-control" href="#recommended-item-carousel" data-slide="next">
                                <i class="fa fa-angle-right"></i>
                            </a>			
                        </div>
                    </div><!--/recommended_items-->
<?php } ?>
            </div>
        </div>
    </div>
</section>

<?php
include_once './templates/footer_widget.php';
include_once './templates/footer.php';
?> 
